<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, minimal-ui" />
        
        <title>Insert Record Element Documentation</title>
        
        <script src="/js/greyspots.js" type="text/javascript"></script>
        <link href="/css/greyspots.css" type="text/css" rel="stylesheet" />
        
        <script src="/js/ace/ace.js" data-ace-base="/js/ace/" type="text/javascript" charset="utf-8"></script>
        <script src="/js/ace/ext-language_tools.js" type="text/javascript"></script>
        <script src="/js/ace/ext-searchbox.js" type="text/javascript"></script>
        
        <script src="doc-library/doc.js" type="text/javascript"></script>
        <link href="doc-library/doc.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
        <gs-jumbo>
            <h1 class="text-center">Insert Record</h1>
        </gs-jumbo>
            
        <gs-container min-width="sml;med;lrg">
            <h3 class="doc-header">Tag:</h3>
            <div class="doc-section doc-mono">
                <pre>&lt;gs-insert src="..."&gt;...&lt;/gs-insert&gt;</pre>
            </div>
            
            <h3 class="doc-header">Description:</h3>
            <div class="doc-section">
                This element is for inserting records in the database.
            </div>
            
            <h1 class="doc-header">Examples:</h1>
            <div class="doc-section">
                <div class="doc-example-description">
                    <span class="h3">Skeleton Example:</span>
                    <p>This is a basic <code>&lt;gs-insert&gt;</code> element. When the "submit" method is called the element makes an ajax call for the table or view named in the "src" attribute and attempts to insert to it.</p>
                </div>
                <gs-doc-example>
                    <template for="html" height="18">
                        <gs-insert id="insert-test" src="gsdoc.tpeople">
                            <label for="first_name">First Name:</label>
                            <gs-text id="first_name" column="first_name"></gs-text>
                            
                            <label for="last_name">Last Name:</label>
                            <gs-text id="last_name" column="last_name"></gs-text>
                            
                            <gs-button onclick="document.getElementById('insert-test').submit();">Done</gs-button>
                        </gs-insert>
                    </template>
                </gs-doc-example>
                
                
                <div class="doc-example-description">
                    <span class="h3">Attribute <code>[addin]</code>:</span>
                    <p>The "addin" attribute adds data to the insert that the user does not see. In this example the "first_name" column will be inserted with the value "Blackberries" even though the user did not type it in.</p>
                </div>
                <gs-doc-example>
                    <template for="html" height="13">
                        <gs-insert id="insert-test" src="gsdoc.tpeople" addin="first_name=Blackberries">
                            <label for="last_name">Last Name:</label>
                            <gs-text id="last_name" column="last_name"></gs-text>
                            
                            <gs-button onclick="document.getElementById('insert-test').submit();">Done</gs-button>
                        </gs-insert>
                    </template>
                </gs-doc-example>
                
                
                <div class="doc-example-description">
                    <span class="h3">Attribute <code>[addin]</code> And The Query String:</span>
                    <p>The "addin" attribute can connect to the query string using doT.js. In this example the "first_name" column will get it's value from the query string column "people_id"</p>
                </div>
                <gs-doc-example query-string="people_id=2341">
                    <template for="html" height="20">
                        <gs-insert id="insert-test" src="gsdoc.tpeople_line" addin="people_id={{! qs.people_id }}">
                            <label for="pet_name">Pet Name:</label>
                            <gs-text id="pet_name" column="pet_name"></gs-text>
                            
                            <label for="birth_date">Birth Day:</label>
                            <gs-date id="birth_date" column="birth_date" value="1-1-2015"></gs-date>
                            
                            <gs-button onclick="document.getElementById('insert-test').submit();">Done</gs-button>
                        </gs-insert>
                    </template>
                </gs-doc-example>
                
                <div class="doc-example-description">
                    <span class="h3">Attribute <code>[pk]</code>:</span>
                    <p>The <code>[pk]</code> attribute defines the PRIMARY KEY column of the object.</p>
                </div>
                <gs-doc-example>
                    <template for="html" height="20">
                        <gs-insert id="insert-test" src="gsdoc.tpeople_line" pk="id">
                            <label for="first_name">First Name:</label>
                            <gs-text id="first_name" column="first_name"></gs-text>
                            
                            <label for="last_name">Last Name:</label>
                            <gs-text id="last_name" column="last_name"></gs-text>
                            
                            <gs-button onclick="document.getElementById('insert-test').submit();">Done</gs-button>
                        </gs-insert>
                    </template>
                </gs-doc-example>
                
                <div class="doc-example-description">
                    <span class="h3">Attribute <code>[seq]</code>:</span>
                    <p>The <code>[seq]</code> attribute contains the sequence used for the PRIMARY KEY specified in the <code>[pk]</code> attribute.</p>
                </div>
                <gs-doc-example>
                    <template for="html" height="20">
                        <gs-insert id="insert-test" src="gsdoc.tpeople_line" seq="gsdoc.global_seq">
                            <label for="first_name">First Name:</label>
                            <gs-text id="first_name" column="first_name"></gs-text>
                            
                            <label for="last_name">Last Name:</label>
                            <gs-text id="last_name" column="last_name"></gs-text>
                            
                            <gs-button onclick="document.getElementById('insert-test').submit();">Done</gs-button>
                        </gs-insert>
                    </template>
                </gs-doc-example>
            
            </div>
        </gs-container>
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
    </body>
</html>